/**
 * Copyright (c) 2018 qar All rights reserved.
 *
 * https://www.qar.io
 *
 * 版权所有，侵权必究！
 */

package com.example.dto;

import com.example.model.dto.BaseDTO;
import com.example.utils.DateUtils;
import com.example.utils.TreeNode;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;

import com.example.validator.group.AddGroup;
import com.example.validator.group.DefaultGroup;
import com.example.validator.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;


import java.io.Serializable;
import java.util.Date;

/**
 * 菜单管理
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
@Data
@Tag(name = "菜单管理")
public class SysMenuDTO extends TreeNode<SysMenuDTO> implements Serializable {
    private static final long serialVersionUID = 1L;

//	@Schema(description = "租户ID")
//	private Long tenantId;

//	@Schema(description = "门店ID")
//	private Long storeId;

    @Schema(description = "菜单名称", required = true)
    @NotBlank(message = "{sysmenu.name.require}", groups = DefaultGroup.class)
    private String name;

    @Schema(description = "菜单URL")
    private String url;

    @Schema(description = "类型  0：菜单   1：按钮", required = false, example = "0")
    @Range(min = 0, max = 1, message = "{sysmenu.type.range}", groups = DefaultGroup.class)
    private Integer menuType;

    @Schema(description = "打开方式   0：内部   1：外部", required = false, example = "0")
    @Range(min = 0, max = 1, message = "{sysmenu.openstyle.range}", groups = DefaultGroup.class)
    private Integer openStyle;

    @Schema(description = "菜单图标")
    private String icon;

    @Schema(description = "权限标识，如：sys:menu:save")
    private String permissions;

    @Schema(description = "排序")
    @Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
    private Integer sort;

    @Schema(description = "上级菜单名称", required = false)
    private String parentName;
	/**
	 * 创建者
	 */
	@Schema(description = "创建者")
	@Hidden
	private Long creator;
	/**
	 * 创建时间
	 */
	@Schema(description = "创建时间")
	@Hidden
	@JsonFormat(locale="zh", timezone="GMT+8", pattern= DateUtils.DATE_TIME_PATTERN)
	@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
	private Date createDate;

	/**
	 * 更新者
	 */
	@Schema(description = "更新者")
	@Hidden
	private Long updator;
	/**
	 * 更新时间
	 */
	@Schema(description = "更新时间") // 序列化（Java 对象转为 JSON）和反序列化（JSON 转为 Java 对象）
	@Hidden
	@JsonFormat(locale="zh", timezone="GMT+8", pattern= DateUtils.DATE_TIME_PATTERN)
	@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
	private Date updateDate;


}
